--0015174762a4e5a04204799d8c3f
Content-Type: text/plain; charset=ISO-8859-1
1. Problem Description:
Apache2::SizeLimit aborts when smaps facility is unavailable. Here's the
error from the error log:
Linux::Smaps: Cannot open /proc/9700/smaps: No such file or directory
BEGIN failed--compilation aborted at
/data/wre/prereqs/lib/perl5/site_perl/5.10.0/i686-linux/Apac he2/SizeLimit.pm
line 98
This installation is part of WebGUI CMS (hence the path, starting with
/data/wre),
but there's nothing specific to WebGUI here - it's just a plain mod_perl
file tree.
The error is not caused by insufficient read permissions - there are
simply no smaps files in /proc/xxx.
Apache2::SizeLimit documentation mentions two possible solutions:
1. Installing an OS patch with smaps support (which may or may not be an
option)
2. Setting $Apache2::SizeLimit::USE_SMAPS to 0 before the first check.
This doesn't
help in this particular case, because the error is generated within
the BEGIN block;
besides, the chunk of code which produces this error, pays no
attention to $USE_SMAPS
I believe the error is caused simply by placing the wrong (or rather
insufficient) statement inside eval() :
if ( eval { require Linux::Smaps } and Linux::Smaps->new($$) ) {
...
}
Linux::Smaps module is present, and obviously returns 1, but
Linux::Smaps->new throws an error
which is not being caught by eval.
I propose the following trivial patch:
--------------------------8<--------------------
*** ./SizeLimit.pm 2009-11-30 09:13:16.000000000 -0600
--- /tmp/SizeLimit.pm.orig 2009-11-30 09:24:04.000000000 -0600
***************
*** 58,64 ****
}
elsif (LINUX) {
! if ( eval { require Linux::Smaps and Linux::Smaps->new($$) } ) {
$HOW_BIG_IS_IT = \&linux_smaps_size_check_first_time;
}
else {
--- 58,64 ----
}
elsif (LINUX) {
! if ( eval { require Linux::Smaps } and Linux::Smaps->new($$) ) {
$HOW_BIG_IS_IT = \&linux_smaps_size_check_first_time;
}
else {
--------------------------8<--------------------
-- Harry Danilevsky
harry.danilevsky [at] gmail.com
2. Used Components and their Configuration:
*** mod_perl version 2.000004
*** using
/data/wre/prereqs/lib/perl5/site_perl/5.10.0/i686-linux/Apac he2/BuildConfig.pm
*** Makefile.PL options:
MP_APR_LIB => aprext
MP_APXS => /data/wre/prereqs/bin/apxs
MP_COMPAT_1X => 1
MP_GENERATE_XS => 1
MP_LIBNAME => mod_perl
MP_USE_DSO => 1
*** The httpd binary was not found
*** (apr|apu)-config linking info
-L/data/wre/prereqs/lib -laprutil-1 -lexpat
-L/data/wre/prereqs/lib -lapr-1 -lrt -lcrypt -lpthread -ldl
*** /data/wre/prereqs/bin/perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.21-51.el, archname=i686-linux
uname='linux centos3 2.4.21-51.el #1 thu aug 16 17:03:59 edt 2007 i686
i686 i386 gnulinux '
config_args='-Dprefix=/data/wre/prereqs -des'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-59)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
USE_LARGE_FILES USE_PERLIO
Built under linux
Compiled at May 27 2009 20:31:04
%ENV:
PERL_LWP_USE_HTTP_10="1"
[at] INC:
/data/wre/prereqs/lib/perl5/5.10.0/i686-linux
/data/wre/prereqs/lib/perl5/5.10.0
/data/wre/prereqs/lib/perl5/site_perl/5.10.0/i686-linux
/data/wre/prereqs/lib/perl5/site_perl/5.10.0
.
*** Packages of interest status:
Apache2 : -
Apache2::Request : 2.08
CGI : 3.42
ExtUtils::MakeMaker: 6.48
LWP : 5.824
mod_perl : -
mod_perl2 : 2.000004
3. This is the core dump trace: (if you get a core dump):
This report was generated by bin/mp2bug on Mon Nov 30 17:25:35 2009 GMT.
--0015174762a4e5a04204799d8c3f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
1. Problem Description:<br><br>=A0 Apache2::SizeLimit aborts when smaps fac=
ility is unavailable. Here's the error from the error log:<br><br>Linux=
::Smaps: Cannot open /proc/9700/smaps: No such file or directory<br>BEGIN f=
ailed--compilation aborted at /data/wre/prereqs/lib/perl5/site_perl/5.10.0/=
i686-linux/Apache2/SizeLimit.pm line 98<br>
<br>This installation is part of WebGUI CMS (hence the path, starting with =
/data/wre),<br>but there's nothing specific to WebGUI here - it's j=
ust a plain mod_perl file tree.<br><br>The error is not caused by insuffici=
ent read permissions - there are <br>
simply no smaps files in /proc/xxx.<br>Apache2::SizeLimit documentation men=
tions two possible solutions:<br>=A0<br>=A0=A0 1. Installing an OS patch wi=
th smaps support (which may or may not be an option)<br><br>=A0=A0 2. Setti=
ng $Apache2::SizeLimit::USE_SMAPS to 0 before the first check. This doesn=
39;t <br>
=A0=A0=A0=A0=A0 help in this particular case, because the error is generate=
d within the BEGIN block;<br>=A0=A0=A0=A0=A0 besides, the chunk of code whi=
ch produces this error, pays no attention to $USE_SMAPS<br><br><br>I believ=
e the error is caused simply by placing the wrong (or rather insufficient) =
statement inside eval() :<br>
<br>=A0=A0=A0=A0=A0=A0=A0 if ( eval { require Linux::Smaps } and Linux::Sma=
ps->new($$) ) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ...<br>=A0=A0=A0=
=A0=A0=A0=A0 }<br><br>Linux::Smaps module is present, and obviously returns=
1, but Linux::Smaps->new throws an error<br>
which is not being caught by eval.<br><br>I propose the following trivial p=
atch:<br><br><br>--------------------------8<--------------------<br><br=
>*** ./SizeLimit.pm=A0=A0=A0=A0=A0 2009-11-30 09:13:16.000000000 -0600<br>-=
-- /tmp/SizeLimit.pm.orig=A0=A0=A0=A0=A0 2009-11-30 09:24:04.000000000 -060=
0<br>
***************<br>*** 58,64 ****<br>=A0 <br>=A0=A0=A0=A0=A0 }<br>=A0=A0=A0=
=A0=A0 elsif (LINUX) {<br>!=A0=A0=A0=A0=A0=A0=A0=A0 if ( eval { require Lin=
ux::Smaps and Linux::Smaps->new($$) } ) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 $HOW_BIG_IS_IT =3D \&linux_smaps_size_check_first_time;<br=
>
=A0=A0=A0=A0=A0=A0=A0=A0=A0 }<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0 else {<br>--- =
58,64 ----<br>=A0 <br>=A0=A0=A0=A0=A0 }<br>=A0=A0=A0=A0=A0 elsif (LINUX) {<=
br>!=A0=A0=A0=A0=A0=A0=A0=A0 if ( eval { require Linux::Smaps } and Linux::=
Smaps->new($$) ) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $HOW_BIG_I=
S_IT =3D \&linux_smaps_size_check_first_time;<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0 }<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0 else {<br><br>=
--------------------------8<--------------------<br><br><br>-- Harry Dan=
ilevsky<br><br><a href=3D"mailto:harry.danilevsky [at] gmail.com">harry.danilevs=
ky [at] gmail.com</a><br><br><br>2. Used Components and their Configuration:<br>
<br>*** mod_perl version 2.000004<br><br>*** using /data/wre/prereqs/lib/pe=
rl5/site_perl/5.10.0/i686-linux/Apache2/BuildConfig.pm<br><br>*** Makefile.=
PL options:<br>=A0 MP_APR_LIB=A0=A0=A0=A0 =3D> aprext<br>=A0 MP_APXS=A0=
=A0=A0=A0=A0=A0=A0 =3D> /data/wre/prereqs/bin/apxs<br>
=A0 MP_COMPAT_1X=A0=A0 =3D> 1<br>=A0 MP_GENERATE_XS =3D> 1<br>=A0 MP_=
LIBNAME=A0=A0=A0=A0 =3D> mod_perl<br>=A0 MP_USE_DSO=A0=A0=A0=A0 =3D> =
1<br><br><br>*** The httpd binary was not found<br><br><br>*** (apr|apu)-co=
nfig linking info<br><br>=A0-L/data/wre/prereqs/lib -laprutil-1=A0 -lexpat =
<br>
=A0-L/data/wre/prereqs/lib -lapr-1 -lrt -lcrypt=A0 -lpthread -ldl <br><br><=
br><br>*** /data/wre/prereqs/bin/perl -V<br>Summary of my perl5 (revision 5=
version 10 subversion 0) configuration:<br>=A0 Platform:<br>=A0=A0=A0 osna=
me=3Dlinux, osvers=3D2.4.21-51.el, archname=3Di686-linux<br>
=A0=A0=A0 uname=3D'linux centos3 2.4.21-51.el #1 thu aug 16 17:03:59 ed=
t 2007 i686 i686 i386 gnulinux '<br>=A0=A0=A0 config_args=3D'-Dpref=
ix=3D/data/wre/prereqs -des'<br>=A0=A0=A0 hint=3Drecommended, useposix=
=3Dtrue, d_sigaction=3Ddefine<br>
=A0=A0=A0 useithreads=3Dundef, usemultiplicity=3Dundef<br>=A0=A0=A0 useperl=
io=3Ddefine, d_sfio=3Dundef, uselargefiles=3Ddefine, usesocks=3Dundef<br>=
=A0=A0=A0 use64bitint=3Dundef, use64bitall=3Dundef, uselongdouble=3Dundef<b=
r>=A0=A0=A0 usemymalloc=3Dn, bincompat5005=3Dundef<br>
=A0 Compiler:<br>=A0=A0=A0 cc=3D'cc', ccflags =3D'-fno-strict-a=
liasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=
=3D64',<br>=A0=A0=A0 optimize=3D'-O2',<br>=A0=A0=A0 cppflags=3D=
'-fno-strict-aliasing -pipe -I/usr/local/include'<br>
=A0=A0=A0 ccversion=3D'', gccversion=3D'3.2.3 20030502 (Red Hat=
Linux 3.2.3-59)', gccosandvers=3D''<br>=A0=A0=A0 intsize=3D4, =
longsize=3D4, ptrsize=3D4, doublesize=3D8, byteorder=3D1234<br>=A0=A0=A0 d_=
longlong=3Ddefine, longlongsize=3D8, d_longdbl=3Ddefine, longdblsize=3D12<b=
r>
=A0=A0=A0 ivtype=3D'long', ivsize=3D4, nvtype=3D'double', n=
vsize=3D8, Off_t=3D'off_t', lseeksize=3D8<br>=A0=A0=A0 alignbytes=
=3D4, prototype=3Ddefine<br>=A0 Linker and Libraries:<br>=A0=A0=A0 ld=3D=
9;cc', ldflags =3D' -L/usr/local/lib'<br>
=A0=A0=A0 libpth=3D/usr/local/lib /lib /usr/lib<br>=A0=A0=A0 libs=3D-lnsl -=
ldl -lm -lcrypt -lutil -lc<br>=A0=A0=A0 perllibs=3D-lnsl -ldl -lm -lcrypt -=
lutil -lc<br>=A0=A0=A0 libc=3D/lib/<a href=3D"http://libc-2.3.2.so">libc-2.=
3.2.so</a>, so=3Dso, useshrplib=3Dfalse, libperl=3Dlibperl.a<br>
=A0=A0=A0 gnulibc_version=3D'2.3.2'<br>=A0 Dynamic Linking:<br>=A0=
=A0=A0 dlsrc=3Ddl_dlopen.xs, dlext=3Dso, d_dlsymun=3Dundef, ccdlflags=3D=
9;-Wl,-E'<br>=A0=A0=A0 cccdlflags=3D'-fPIC', lddlflags=3D'-=
shared -O2 -L/usr/local/lib'<br>
<br><br>Characteristics of this binary (from libperl): <br>=A0 Compile-time=
options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP<br>=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 USE_LARGE_FILES USE_PERLIO=
<br>=A0 Built under linux<br>=A0 Compiled at May 27 2009 20:31:04<br>
=A0 %ENV:<br>=A0=A0=A0 PERL_LWP_USE_HTTP_10=3D"1"<br>=A0 [at] INC:<br=
>=A0=A0=A0 /data/wre/prereqs/lib/perl5/5.10.0/i686-linux<br>=A0=A0=A0 /data=
/wre/prereqs/lib/perl5/5.10.0<br>=A0=A0=A0 /data/wre/prereqs/lib/perl5/site=
_perl/5.10.0/i686-linux<br>
=A0=A0=A0 /data/wre/prereqs/lib/perl5/site_perl/5.10.0<br>=A0=A0=A0 .<br><b=
r>*** Packages of interest status:<br><br>Apache2=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 : -<br>Apache2::Request=A0=A0 : 2.08<br>CGI=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 : 3.42<br>ExtUtils::MakeMaker: 6.48<br>LWP=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 : 5.824<br>
mod_perl=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 : -<br>mod_perl2=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 : 2.000004<br><br><br>3. This is the core dump trace: (if you get=
a core dump):<br><br>=A0 <br><br>This report was generated by bin/mp2bug o=
n Mon Nov 30 17:25:35 2009 GMT.<br><br>
<br><br><br>
--0015174762a4e5a04204799d8c3f--
